<%@ page contentType="text/html; charset=utf-8"%>
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>数据 - AdminLTE2定制版 | Log in</title>
    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
    <link rel="stylesheet" href="../../../../plugins/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="../../../../plugins/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="../../../../plugins/ionicons/css/ionicons.min.css">
    <link rel="stylesheet" href="../../../../plugins/adminLTE/css/AdminLTE.css">
    <link rel="stylesheet" href="../../../../plugins/iCheck/square/blue.css">

</head>

<script>
    window.onload = function () {
        if (window.parent.window != window) {
            window.top.location = "/login.jsp";
        }
    }
</script>

<body class="hold-transition login-page">
<div class="login-box">
    <div class="login-logo">
        <a href="all-admin-index.html">SaaS外贸出口云平台</a>
    </div>
    <!-- /.login-logo -->
    <div class="login-box-body">
        <p class="login-box-msg"><font size="4">密码修改</font></p>
        <div class="form-group has-feedback">
            原密码:<input type="text" name="password" value="${password}" class="form-control" readonly="readonly">
        </div>
        <div class="form-group has-feedback">
            新密码:<input type="password" id="newPassword1" name="newPassword1" value="" class="form-control"
                       placeholder="密码">
        </div>
        <div class="form-group has-feedback">
            确认新密码:<input type="password" id="newPassword2" name="newPassword2" value="" class="form-control"
                         placeholder="密码">
        </div>
        <div class="row">
            <div class="col-xs-8">
                <div class="checkbox icheck">
                    <span id="span"></span>
                    <label class=""><font color="red">${error}</font></label>
                </div>
            </div>
            <div class="col-xs-4">
                <button type="buttom" class="btn btn-primary btn-block btn-flat" onclick="ajax()">确定</button>
            </div>
        </div>
    </div>
</div>
<script src="../plugins/jQuery/jquery-2.2.3.min.js"></script>
<script src="../plugins/bootstrap/js/bootstrap.min.js"></script>
<script src="../plugins/iCheck/icheck.min.js"></script>
<script src="http://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js"></script>
<script>
    var obj = new WxLogin({
        self_redirect:false,
        id:"login_container",
        appid: "wx3bdb1192c22883f3",
        scope: "snsapi_login",
        redirect_uri: "http://note.java.itcast.cn/weixinlogin"
    });
</script>

<script src="${ctx}/plugins/jQuery/jquery-3.3.1.js"></script>
<script>
    function ajax() {
        var newPassword1 = document.getElementById("newPassword1").value;
        var newPassword2 = document.getElementById("newPassword2").value;

        $.ajax({
            //type: "POST",
            url: "${pageContext.request.contextPath}/system/user/changePassword.do",
            //contentType:"application/json",
            dataTape: "json",
            data: {"newPassword1": newPassword1, "newPassword2": newPassword2},
            success: function (data) {
                if (data == 0) {
                    alert("修改成功");
                    location.href = "${pageContext.request.contextPath}/logout.do"
                } else if (data == 1) {
                    alert("两次输入的密码不一致");
                    location.reload();
                } else if (data == 2) {
                    alert("新密码不能为空");
                    location.reload();
                }
            }
        })

    }
</script>
</body>
</html>
